<?php
/**
 * Create By: PhpStorm
 * User: yihua
 * File: GetUserFeedback.php
 * Date: 2017/2/7
 * Time: 1:10
 */

namespace app\api\model\page\user;

use app\api\model\dao\UserFeedback;
use app\library\Error;
use app\library\PageBase;
use think\Log;

class GetUserFeedback extends PageBase
{
    protected $objFeedback;

    public function __construct()
    {
        parent::__construct();
        $this->objFeedback = new UserFeedback();
    }

    public function excute($param)
    {
        $ret = $this->checkToken($param);
        if (false === $ret) {
            //return $this->getRes(Error::ERR_NO_AUTH);
        }
        if (!isset($param['user_id'])) {
            Log::alert('get user feedback ' . json_encode($param));
            return $this->getRes(Error::ERR_PARAM);
        }
        $ret = $this->objFeedback->getFeedback($param['user_id']);
        if (false === $ret) {
            return $this->getRes(Error::ERR_SYS);
        }
        $this->data = $ret;
        return $this->getRes();
    }
}
